<!DOCTYPE html>
<html lang="en">
{include file='Public:head'}
</head>

<body data-type="widgets">
    <script src="/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        {include file='Public:header'}
        {include file='Public:menu2'}
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">商品分类</div>

                            </div>
                            <div class="widget-body  am-fr">

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-6" >
                                    <div class="am-form-group" >
                                        <div class="am-btn-toolbar" >
                                            <div class="am-btn-group am-btn-group-xs" >
                                                <a href="{:Url('Goods/classifyAdd')}" class="am-btn am-btn-default am-btn-success" ><span class="am-icon-plus" ></span> 新增</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="am-u-sm-12">
                                    <table  class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                        <thead>
                                            <tr>
                                                <th>分类ID</th>
                                                <th>分类名称</th>
                                                <th>手机显示名称</th>
                                                <th>是否显示</th>
                                                <th>上级id</th>

                                                <th>排序</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        {foreach $goods_category as $k=>$v}
                                            <tr class="gradeX">
                                                <td>{$v.id}</td>
                                                <td>{$v.name}</td>
                                                <td>{$v.mobile_name}</td>
                                                <td>
                                                    {switch name='$v.is_show' }
                                                    {case value="0" }否{/case}
                                                    {case value="1"}是{/case}
                                                    {/switch}
                                                </td>
                                                <td>
                                                    {if $v.parent_id==0}顶级{else}{$v.parent_id}{/if}
                                                </td>

                                                <td>{$v.sort_order}</td>
                                                <td>
                                                    <div class="tpl-table-black-operation">
                                                        <a href="{:Url('Goods/classifyAdd')}?id={$v.id}" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
                                                        <a href="javascript:void(0);" onclick="shan('{$v.id}')" class="btn btn-danger" title="删除"><i class="fa fa-trash-o"></i></a>
                                                    </div>
                                                </td>

                                            </tr>
                                        {/foreach}
                                            <!-- more data -->
                                        </tbody>
                                    </table>
                                </div>
                                <div class="am-u-lg-12 am-cf">

                                    <div class="am-fr">
                                        {$goods_category->render()}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <script src="http://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>
    <script src="/assets/js/amazeui.datatables.min.js"></script>
    <script src="/assets/js/dataTables.responsive.min.js"></script>
    <script src="/assets/js/app.js"></script>

</body>
<script style="text/javascript">
    function shan(id){
        $.post("{:url('Goods/commodityClassifyDelete')}",{id:id},function (res) {
            if(res.code ==200){
                alert(res.msg);
                location.reload();
            }else{
                alert(res.msg);
            }
        });

    }

</script>
</html>